﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ChipSharp
{
    class Func<T> where T : IComparable<T>
    {
        public static T Min(T a, T b)
        {
            return (a.CompareTo(b) < 0) ? a : b;
        }
        public static T Max(T a, T b)
        {
            return (a.CompareTo(b) > 0) ? a : b;
        }
        public static T MinMax(T x, T min, T max)
        {
            return Min(Max(x, min), max);
        }
    }
}
